#ifndef __THREAD_H__
#define __THREAD_H__

#include "../Delegate/Delegate.h"

namespace xgu{

typedef Delegate<void> ThreadStart;

class Thread
{
public:
	typedef int TID;
	typedef int TLS;

	Thread(const ThreadStart& thread_start);

	void Start();

	// -----------------------------------------------------------

	static TID		getTid();

	static TLS		TlsAlloc();
	static bool		TlsFree(TLS tls);
	static bool		TlsSet(TLS tls, void* value);
	static void*	TlsGet(TLS tls);

protected:
	static void ThreadEntry(void* param);

private:
	ThreadStart* thread_start_;
};

}

#endif // __THREAD_H__
